package cn.kmia.hrm.pojo.system;

import cn.kmia.hrm.pojo.BasePojo;
import org.nutz.dao.entity.annotation.*;

import java.io.Serializable;
import java.util.List;

/**
 * @项目：hrm
 * @作者：4K
 * @描述：角色
 * @日期：created in 13:53 2017/3/30
 */
@Table("sys_role")
public class Role extends BasePojo implements Serializable {

    @Id
    private int id;

    @Column
    @Comment("名称")
    @ColDefine(type = ColType.VARCHAR, width = 50)
    private String name;

    @Column
    @Comment("描述")
    @ColDefine(type = ColType.VARCHAR, width = 500)
    private String description;

    /**
     * 角色-权限
     */
    @ManyMany(from = "role_id", to = "permission_id", relation = "sys_role_permission")
    private List<Permission> permissions;

    /**
     * 角色-用户
     */
    @ManyMany(from = "role_id", to = "user_id", relation = "sys_user_role")
    private List<User> users;

    /**
     * 权限名称
     */
    private String perNames;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<User> getUsers() {
        return users;
    }

    public void setUsers(List<User> users) {
        this.users = users;
    }

    public List<Permission> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<Permission> permissions) {
        this.permissions = permissions;
    }

    public String getPerNames() {
        return perNames;
    }

    public void setPerNames(String perNames) {
        this.perNames = perNames;
    }
}
